package cn.zust.edu.cn;
/**
 * 
 * @author czg
 * @since 2023/3/7 10:50
 */
public class Rectangle implements IShape {
    Point ptTopLeft;
    Point ptTopRight;
    int width;
    int height;

    public Rectangle() {
        this.ptTopLeft = new Point();
        this.ptTopRight = new Point();
        this.width = 0;
        this.height = 0;
    }

    public Rectangle(Point topleft, int height, int width) {
        this.ptTopLeft = topleft;
        this.ptTopRight = new Point(topleft.x + width, topleft.y);
        this.width = width;
        this.height = height;
    }

    @Override
    public double perimeter() {
        return 2 * (width + height);
    }

    @Override
    public double area() {
        return width * height;
    }

    @Override
    public void draw() {
        System.out.println("Drawing Rectangle at (" + ptTopLeft.x + ", " + ptTopLeft.y + ") with width " + width + " and height " + height);
    }
}